﻿@using Permissions
@using Abp.Web.Mvc.Extensions
@model Abp.Application.Services.Dto.ListResultDto<Permissions.EmployeeApp.Dto.EmployeeDto>

@*@{
        ViewBag.Title = "Employee";
    }*@

<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#btnAdd").click(function () {
            location.href = "Create";
        })

        $("#btnRole").click(function () {
            var Id = $("input[name='choice']:checked").val();
            if (Id == null || Id == "") {
                alert("请选择用户!");
            } else {
                location.href = "../Employee_Role/Index/" + Id;
            }
        })
    })
</script>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

<div>
    <button data-toggle="modal" data-target="#PersonCreateModal" class="btn btn-primary pull-right" id="btnRole" style="margin-left:15px;">
        <i class="fa fa-plus"></i> 用户角色设置
    </button>
    <button data-toggle="modal" data-target="#PersonCreateModal" class="btn btn-primary pull-right" id="btnAdd">
        <i class="fa fa-plus"></i> 新增员工
    </button>
    <table class="table">
        <tr>
            <th><input type="checkbox" name="checkAll" id="checkAll" /></th>
            <th>员工姓名</th>
            <th>所属部门</th>
            <th>编辑 | 删除</th>
        </tr>
        @foreach (var employee in Model.Items)
        {
            <tr>
                <td><input type="checkbox" name="choice" class="checknum" value="@employee.Id" /> </td>
                <td>@employee.Name</td>
                <td>@employee.Department.DepName</td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = employee.Id }) |
                    @Html.ActionLink("Delete", "Delete", new { id = employee.Id })
                </td>
            </tr>
        }
    </table>
</div>
